<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page contentType="text/html; charset=gb2312"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.store.*"%>
<%@page import="com.jedi.*"%>
<%@page import="java.util.*"%>
<%@include file="../global_var.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10709";
if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}
int sgid   	= ParamUtils.getIntParameter(request,"sgid",0);//等级编号
SevgradeMgr sevgradeMgr= new SevgradeMgr();
Sevgrade sevgrade = sevgradeMgr.get(sgid);
String sgname		= ParamUtils.getParameter(request,"sgname","");//等级名称
String cmd = ParamUtils.getParameter(request,"cmd","");
String strErr = "";
if (cmd.trim().equals("update")) {

	
	if (strErr.trim().equals("") && sgid==0) {
		strErr = "请输入等级编号!";
	}
		if (strErr.trim().equals("") &&sgname.trim().equals("")) {
		strErr = "请输入等级名称!";
	}
	if (strErr.trim().equals("")) {
		
		sevgrade.setSgid(sgid);
		sevgrade.setSgname(sgname);
		sevgrade.update();
		
	if (sevgrade.hasErr()) strErr = sevgrade.getErrHtml();
	}

}

if (cmd.trim().equals("delete")) {

	
	
	if (strErr.trim().equals("")) {
		
		sevgrade.setSgid(sgid);
		//sevgrade.setSgname(sgname);
		sevgrade.delete();
		
	if (sevgrade.hasErr()) strErr = sevgrade.getErrHtml();
	}

}
if (strErr.trim().equals("")) {

	sgid=sevgrade.getSgid();
	sgname=sevgrade.getSgname();


}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    
<title></title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
   <link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function chk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "update";
	return true;
}
function clk_goback() {
	history.back();
}
function clk_delete_submit() {
	if (!confirm("确定要删除此信息吗？"))
		return;
	var oForm = document.operatorForm;
	oForm.cmd.value = "delete";
	oForm.submit();
}
</script>

</head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="98%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td >
      <form name="operatorForm" method="post" >
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
       
      
        <tr> 
          <td height="100" align="center" valign="top" style="padding-top:10px;padding-bottom:10px;">
            <table width="96%" border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
               <tr>
                <td height="24" colspan="2" bgcolor="#EDEDF0" style="padding-left:10px;">
                提示：<font color="red">*</font> 号为必填项，请您认真填写
                </td>
              </tr>
            <%if (!strErr.trim().equals("")) {%>
             
              <tr> 
                <td height="24" colspan="2" bgcolor="#D7D7DB" style="padding-left:10px;">
                  错误提示：<font color=red><%=strErr%></font>                </td>
              </tr>
              <%}%>
            <tr> 
                <td height="24" colspan="2" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>服务等级信息</strong></font>                </td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" >服务等级编号<span style="padding-right:5px;"><font color="red">*</font></span></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="sgid" type="text" value="<%=sgid%>"  size="30" maxlength="20">
                </label></td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">等级名称：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="sgname" type="text" value="<%=sgname%>"  size="30" maxlength="30" >
                </label></td>
              </tr>
            
              <tr> 
                <td bgcolor="#EDEDF0" colspan="2" align="center">
                  <input type="submit" name="submit" value="保存" onclick="return chk_submit();" class="inputButton"> 
                <input type="submit" onclick="return clk_delete_submit();" name="btn" value="删 除" class="inputButton"> 
                  <input type="button" name="back" value="返回" onclick="clk_goback()" class="inputButton">
                  <input type="hidden" name="cmd" value="">                  </td>
              </tr>
            </table>
          </td>
        </tr>
    
      </table>
          </form>
    </td>
  </tr>
</table>

<%if (cmd.equals("update") && strErr.trim().equals("")){%>
<script language="javascript">
alert("销售修改成功!");
location.href="sevgrade_list.jsp";
</script>
<%}%>
<%if (cmd.equals("delete") && strErr.trim().equals("")){%>
<script language="javascript">
alert("销售删除成功!");
location.href="sevgrade_list.jsp";
</script>
<%}%>
</body>
</html>
